package cn.zhang.controller;

import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.ai.chat.model.ChatModel;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Slf4j
public class ChatModelController {

    @Resource
    private ChatModel dashScopeChatModel;


    @GetMapping(value = "/chatModel/dochat")
    public String doChat(@RequestParam(name = "msg",defaultValue = "你是谁") String msg){
        String result = dashScopeChatModel.call(msg);
        log.info("响应："+result);
        return result;
    }

}
